/**
 * Created by x on 17-8-6.
 */
angular.module('tribalc').controller('AddSmartController',
    ['$scope','$rootScope','$stateParams','Api','Enum','LockinfoModel','Alert','$state',function ($scope,$rootScope,$stateParams,Api,Enum,LockinfoModel,Alert,$state) {
        $scope.apartmentId = $stateParams.apartmentId;
        $scope.lockList = Enum.LockList;
        $scope.submitAddLockinfo=submitAddLockinfo;
        $scope.additionalLockInfo= new LockinfoModel();


        function submitAddLockinfo(lockinfo) {
            // console.log(lockinfo)
            lockinfo.apartmentId = $scope.apartmentId;
            Api.creatLock(lockinfo,function (result) {
                // console.log(result)
                // $scope.additionalLockInfo= new LockinfoModel();
                Alert.alertBox('锁提交成功！',function () {
                    $state.go('company.companySmartEquipmentDetail',{apartmentId:$scope.apartmentId});
                });
            });
        }
    }]);

